//
//  modelToView.m
//  RouteSearcher
//
//  Created by wenqingzhou on 3/3/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "modelToView.h"


@implementation modelToView

+(UIImage *)pathTypeToImage:(PathModel *)path
{
	UIImage *pathImage;
	switch([path.type intValue])
	{
		case 1:
		case 3:
		case 4:
		case 5:
		case 8:
		case 21:
		case 23:
		case 24:
		case 22:
		case 25:
			pathImage=[UIImage imageNamed:@"bus.gif"];
			break;
		case 2:
			pathImage=[UIImage imageNamed:@"tram.gif"];
			break;
		case 6:
			pathImage=[UIImage imageNamed:@"metro.png"];
			break;
		case 7:
			pathImage=[UIImage imageNamed:@"ferry.gif"];
			break;
		case 12:
		case 13:
			pathImage=[UIImage imageNamed:@"train.gif"];
			break;
		default:
			pathImage=[UIImage imageNamed:@"walk.gif"];
	}
	return pathImage;
}
+(UIImageView *)pathTypeToImageView:(PathModel *)path WithFrame:(CGRect)frame
{
	UIImageView *typeImage=[[UIImageView alloc] initWithFrame:frame];
	typeImage.image=[modelToView pathTypeToImage:path];
	return [typeImage autorelease];
}

+(UILabel *)stringToTextWithSmallFontCenterAlign:(NSString *)str WithFrame:(CGRect)frame

{
	UILabel *label=[[UILabel alloc] initWithFrame:frame];
	label.font=[UIFont systemFontOfSize:11];
	label.text=str;
	[label setTextAlignment:UITextAlignmentCenter];
	return [label autorelease];
}


+(UILabel *)stringToTextWithSmallFontLeftAlign:(NSString *)str WithFrame:(CGRect)frame

{
	UILabel *label=[[UILabel alloc] initWithFrame:frame];
	label.font=[UIFont systemFontOfSize:11];
	label.text=str;
	[label setTextAlignment:UITextAlignmentLeft];
	return [label autorelease];
}

+(UILabel *)stringToTextWithLargeFontLeftAlign:(NSString *)str WithFrame:(CGRect)frame

{
	UILabel *label=[[UILabel alloc] initWithFrame:frame];
	label.text=str;
	label.font=[UIFont systemFontOfSize:14];
	[label setTextAlignment:UITextAlignmentLeft];
	return [label autorelease];
}

+(UILabel *)stringToTextWithLargeFontCenterAlign:(NSString *)str WithFrame:(CGRect)frame

{
	UILabel *label=[[UILabel alloc] initWithFrame:frame];
	label.font=[UIFont systemFontOfSize:14];
	label.text=str;
	[label setTextAlignment:UITextAlignmentCenter];
	return [label autorelease];
}



@end
